﻿using System.Collections.Generic;
using NUnit.Framework;


namespace dictionaryconverter.test
{
    [TestFixture]
    public class Convertertest
    {

        [Test]
        public void ZerlegeKeyValue_Ein_gueltiger_Ausdruck()
        {

            var keyvalue = new[] { "abc=1" };

            var dicEintrag = DictionaryConverter.ZerlegeKeyValue(keyvalue);

            Assert.AreEqual(dicEintrag[0][0], "abc");
            Assert.AreEqual(dicEintrag[0][1], "1");
        }

        [Test]
        public void ZerlegeKonfiguration_Gueltiger_Ausdruck()
        {

            const string konfig = "a=1;b=2";

            var dicEintrag = DictionaryConverter.ZerlegeKonfiguration(konfig);

            Assert.AreEqual(dicEintrag[0], "a=1");
            Assert.AreEqual(dicEintrag[1], "b=2");
        }

        [Test]
        public void CreateDictionary_Zwei_Gueltige_Ausdruecke()
        {
            var konfig = new[]
                             { 
                new[] { "a", "1" }, 
                new[] { "b", "2" } 
            };
 
            var dic = DictionaryConverter.CreateDictionary(konfig);

            Assert.AreEqual("1", dic["a"]);
            Assert.AreEqual("2", dic["b"]);
        }

        [Test]
        public void Testfall_Vier()
        {
            var dic = DictionaryConverter.ToDictionary("abc=1;def=2");
            var list = new Dictionary<string, string> {{"abc", "1"}, {"def", "2"}};
            Assert.AreEqual(list, dic);
        }

        [Test]
        public void Testfall_Fuenf()
        {


        }

    }
}
